package com.wuliu.servlet;

import com.wuliu.dao.BusinessClassDAO;
import com.wuliu.dao.impl.BusinessClassDAOImpl;
import com.wuliu.model.BusinessClass;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/admin/business_class")
public class AdminBusinessClassServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        BusinessClassDAO businessClassDAO=new BusinessClassDAOImpl();
        List<BusinessClass> businessClasses = businessClassDAO.findAll();
        req.setAttribute("businessClasses",businessClasses);
        req.getRequestDispatcher("/WEB-INF/view/admin/business_class.jsp").forward(req,resp);

    }
}
